<%-- 
  - Author: Ismail Basha
  - Date: 4-Jan-'2012
  - Copyright Notice: TRAKHEES
  - Description: list.jsp
 --%>
 
<%@ include file="/WEB-INF/view/include.jsp"%>
<%@ page import="ae.pcfc.etks.online.web.*"%>
<script type="text/javascript"
	src='<c:url value="resources/js/ui/jquery.multiselect.min.js"/>'></script>

<script type="text/javascript">

	$()
			.ready(
					function() {
						//$("input:submit, input:reset, input:button, input:file").button();
						$("#arrRoles").multiselect();
						$("#StaffRegister")
								.validate(
										{
											onfocusout : false,
											onkeyup : false,
											rules : {

												strClientPersonNameENG : "required",
												strClientPersonNameARB : "required",
												strMobileNo : "required",
												strUserName : "required",
												strPassword : {
													required : true,
													minlength : 8,
													maxlength : 12
												},
												strConfirmPassword : {
													required : true,
													equalTo : "#strPassword"
												},
												iSecQuestion : "required",
												strSecretAnswer : "required",
												strEmailAddress : "required",
												strStatus : "required"
											},
											showErrors : function(errorMap,
													errorList) {

												var errors = '<ul>';
												var label;
												if (errorList.length) {
													$.each(errorMap, function(
															name, value) {
														label = $(
																"label[for='"
																		+ name
																		+ "']")
																.html();
														label = value + '['
																+ label + ']';
														errors = errors
																+ '<li>'
																+ label
																+ '</li>';

													});
													errors = errors + '</ul>';
													jAlert('error', errors,
															'<spring:message code="label.errormessage" />');
												}
											}

										});

					});
</script>

<div id="container" dir='<spring:message code="page.dir"/>'
	align='<spring:message code="page.align"/>' class="t_fin-black-txt">

	<form:form name="StaffRegister" id="StaffRegister" method="POST"
		enctype="multipart/form-data"
		modelAttribute="<%=ConstantsAdmin.ADMIN_INTERNAL_STAFF_INFO%>">


		<spring:hasBindErrors name="<%=ConstantsAdmin.ADMIN_INTERNAL_STAFF_INFO%>">
			<script type="text/javascript">
				$(document)
						.ready(
								function() {
									jAlert(
											'error',
											'<li><form:errors path="*" delimiter="<li>"/>',
											'<spring:message code="label.errormessage" />');
								});
			</script>
		</spring:hasBindErrors>

		<div class="ui-widget_c ui-corner-all">
			<div class="ui-jqgrid-titlebar ui-widget-header ui-corner-top ui-helper-clearfix">
				<spring:message code="label.edit.internal.staff" />
			</div>
			<fieldset>
				<legend>
					<spring:message code="label.login.details" />
				</legend>
			</fieldset>			
			<div class="ui-widget_content_c t_form-left">
					<div class="fm-req">
						<form:label path="strPersonNameENG">
						<span class="t_star">*</span>
							<spring:message code="label.empname.eng" />
						</form:label>
						<form:input path="strPersonNameENG" id="strClientPersonNameENG"
							size="20" maxlength="100" />
					</div>
					<div class="fm-req">
						<form:label path="strPersonNameARB">
						<span class="t_star">*</span>
							<spring:message code="label.empname.arab" />
						</form:label>
						<form:input path="strPersonNameARB" id="strClientPersonNameARB"
							size="20" maxlength="100" />
					</div>
					<div class="fm-req">
						<form:label path="strUserName">
						<span class="t_star">*</span>
							<spring:message code="label.client.person.register.user.name" />
						</form:label>
						<form:input path="strUserName" id="strUserName" size="20"
							maxlength="100" readonly="true"/>
					</div>
					<div class="fm-req">
						<form:label path="strPassword">
						<span class="t_star">*</span>
							<spring:message code="label.client.person.register.password" />
						</form:label>
						<form:password path="strPassword" id="strPassword" size="20"
							maxlength="100" />
					</div>
					<div class="fm-req">
						<form:label path="strConfirmPassword">
						<span class="t_star">*</span>
							<spring:message
								code="label.client.person.register.confirmPassword" />
						</form:label>
						<form:password path="strConfirmPassword" id="strConfirmPassword"
							size="20" maxlength="100" />
					</div>
					<div class="fm-req">
						<form:label path="iSecQuestion">
						<span class="t_star">*</span>
							<spring:message code="label.secretquestion" />
						</form:label>
						<c:choose>
							<c:when
								test='${requestScope.requestContextAttribute.locale.language == "ar"}'>
								<form:select path="iSecQuestion" items="${userSecretQuestion}"
									id="iSecQuestion" itemLabel="labelAr" itemValue="id"
									class="fm-opt"/>
							</c:when>
							<c:otherwise>
								<form:select path="iSecQuestion" items="${userSecretQuestion}"
									id="iSecQuestion" itemLabel="labelEn" itemValue="id"
									class="fm-opt"/>
							</c:otherwise>
						</c:choose>

					</div>
					<div class="fm-req">
						<form:label path="strSecretAnswer">
						<span class="t_star">*</span>
							<spring:message code="label.client.person.register.secretAnswer" />
						</form:label>
						<form:input path="strSecretAnswer" id="strSecretAnswer" size="20"
							maxlength="100" />
					</div>

					<div class="fm-req">
						<form:label path="strEmailAddress">
						<span class="t_star">*</span>
							<spring:message code="label.client.person.register.emailAddress" />
						</form:label>
						<form:input path="strEmailAddress" id="strEmailAddress" size="20"
							maxlength="100" />
					</div>

					<div class="fm-req">
						<form:label path="strMobileNo">
						<span class="t_star">*</span>
							<spring:message code="label.client.person.register.mobNo" />
						</form:label>
						<form:input path="strMobileNo" id="strMobileNo" size="20"
							maxlength="100" />
					</div>
					<div style="display:none;">
						<form:label path="strMobileNotification">
							<spring:message code="label.client.person.register.notifications" />
						</form:label>
						<div class="fm-multi">
							<spring:message code="label.emailnotification" />
							<form:checkbox path="strEmailNotification" value="Y"
								id="strEmailNotification" cssClass="opt-input"/>
							<spring:message code="label.smsnotification" />
							<form:checkbox path="strMobileNotification" value="Y"
								id="strMobileNotification" cssClass="opt-input"/>
						</div>
					</div>
					
					<!--<div style="clear:both"><br></div>

					--><div class="fm-req">
						<form:label path="strStatus">
						<span class="t_star">*</span>
							<spring:message code="label.accountstatus" />
						</form:label>
						<span style="width: 50px; font-weight: normal;">
						<c:forEach
								items="${userAdminLockUser}" var="status">
								<c:out value="${status.displayLabel}"></c:out>
								<form:radiobutton path="strStatus" id="strStatus"
									value="${status.id}" cssClass="opt-input"></form:radiobutton>
							</c:forEach> </span>
					</div>
				</div>
				<fieldset>
					<legend>
						<spring:message code="label.roles" />
					</legend>
				</fieldset>
				<div class="t_form-left">
					<div class="fm-req">
						<spring:message code="label.user.role" />
						<form:select path="arrRoles" id="arrRoles" items="${adminInternalStaffRolesModelKey}" multiple="true" itemLabel="displayLabel" itemValue="id">
						</form:select>
					</div>
				<div id="fm-submit" class="fm-req">
					<input
						type="submit" name="submit"
						value="<spring:message code="label.button.save" />" class="t_btns submit"/>
				
					<input type="reset" name="reset"
						value="<spring:message code="label.button.reset" />" class="t_btns reset"/> 

				</div>
			</div>
		</div>

	</form:form>
</div>